package com.gz.logistics.library.pojo;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

/**
 * 杜志娟
 * 小区列表
 * Created by Administrator on 2016/3/11.
 */
public class CommunityGroup extends CustomerSpinnerObject{
    private int group_id;//小区id

    public int getGroup_id() {
        return group_id;
    }

    public void setGroup_id(int group_id) {
        this.group_id = group_id;
    }

    public String getGroup_name() {
        return group_name;
    }

    public void setGroup_name(String group_name) {
        this.group_name = group_name;
    }

    private String group_name;//小区的名称
    @Override
    public String toString() {
        return group_name;
    }

    public static List<CommunityGroup> parse(JSONArray jsonArray) throws JSONException {
        if (jsonArray == null || jsonArray.length() <= 0){
            return null;
        }
        List<CommunityGroup> groups = new ArrayList<CommunityGroup>();
        for (int i = 0 ; i < jsonArray.length() ; i ++ ){
            CommunityGroup  group = new CommunityGroup();
            group.group_id = (jsonArray.getJSONObject(i)).getInt("group_id");
            group.group_name = (jsonArray.getJSONObject(i)).getString("group_name");
            groups.add(group);
        }
        return groups;
    }
}
